package com.android_map_app.data;

import android.location.Location;
import android.location.LocationManager;

public class User {

	private String username;
	private String userId;
	private Location location;
	private Object locationLock;

	public User() {	
		this.locationLock = new Object();
	}
	
	public User(String username, String longitude, String latitude) {
		this();
		this.username = username;
		this.location = new Location(LocationManager.GPS_PROVIDER);
		this.location.setLongitude(Double.parseDouble(longitude));
		this.location.setLatitude(Double.parseDouble(latitude));
	}
	
	public User(String username, String userId) {
		this();
		this.username = username;
		this.userId = userId;
	}

	public void setLocation(Location location) {
		synchronized (locationLock) {
			this.location = location;
		}
	}
	public Location getLocation() {
		synchronized (locationLock) {
			return location;
		}
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}
}
